import { requestApi } from '@/utils/request'
import type { PublishKeywordsResponse } from '@/types/publish'

// 百度AI提取游记关键词
export const getPublishKeywords = (text: string) => {
  return requestApi<PublishKeywordsResponse>({
    url: '/article-keyword',
    method: 'POST',
    data: {
      text,
    },
  })
}

// 发布游记：图片类型
type PublishImageTravelRequest = {
  title: string
  content: string
  city: string
  address: string
  province: string
  tag: string[]
  image: string[]
}
export const publishImageTravelAPI = (data: PublishImageTravelRequest) => {
  return requestApi({
    url: '/article-publish',
    method: 'POST',
    data,
  })
}

// 发布游记：视频类型
type PublishVideoTravelRequest = {
    title: string
    content: string
    city: string
    address: string
    province: string
    tag: string[]
    videoPoster: string
    videoUrl: string
    videoWidth: number
    videoHeight: number
}
export const publishVideoTravelAPI = (data: PublishVideoTravelRequest) =>{
    return requestApi({
        url: '/article-publish-Video',
        method: 'POST',
        data
    })
}